package com.hunan.api.catv.utils;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneOffset;

/**
 * @Author: wangchao
 * @Date: 2020/12/2 13:52
 */
public class DateUtils {
    /**
     * LocalDate 转秒
     */
    public static Long toLocalDateSecond(LocalDate localDate) {
        return localDate.atStartOfDay(ZoneOffset.ofHours(8)).toInstant().toEpochMilli() / 1000L;
    }

    /**
     * LocalDateTime 转秒
     */
    public static Long toLocalDateTimeSecond(LocalDateTime localDateTime) {
        return localDateTime.toEpochSecond(ZoneOffset.ofHours(8));
    }
}
